home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / gfonts45.zip / GFONTS45.DOC < prev    next >
Text File  |  1993-01-06  |  15KB  |  323 lines

  1.                                 G F O N T S
  2.  
  3.                        Version 4.5  -  January, 1993
  4.  
  5.                               Dwain Goforth 
  6.                             Milestone Software 
  7.  
  8.                     1260 Sunset Ave., Arcata, CA 95521 
  9.                             (707) 822-1291 
  10.  
  11.  
  12.  
  13. WHAT IS GFONTS?
  14.  
  15. GFONTS is a package of 87 graphic fonts in either QuickBASIC or assembly 
  16. language for use in your QB programs.  Each font is in its own subprogram 
  17. that you CALL from within QB.  The fonts are named by the ROM character set 
  18. they read, the size in pixels (in x and y dimensions), and occasionally with 
  19. a tag like "ital" meaning italics.
  20.  
  21. GFONTS works with QuickBASIC 4.x and BASIC 7.x (far string support is 
  22. included.)
  23.  
  24. There are two methods that GFONTS uses to display fonts and two sources for 
  25. the font character data.  GFONTS includes 26 assembly language font routines 
  26. and 61 QuickBASIC font routines. Also GFONTS can use either native character 
  27. sets found in your video ROM or font files BLOADed from disk.
  28.  
  29. ALL source code is included, allowing you to customize your own fonts.
  30.  
  31. The QB subroutine fonts are in individual subprograms for three reasons: 1) 
  32. They are faster this way. 2) Only those fonts you wish to use can be kept in 
  33. your final program, reducing the overhead in your program. 3) As discrete 
  34. units, a font can be copied to a new subprogram and easily modified to 
  35. create a new custom font.
  36.  
  37.                          -----------------------------
  38.  
  39. The GFONTS package comes with the following files:
  40.  
  41. $GFASM.BAS - Source code for initializing the assembly language GFONT 
  42. routines.  It also has complete code to BLOAD both 4k 8x16 pixel font files 
  43. (for use with the VGAxxx assembly routines) and 12k 16x24 pixel font files 
  44. for use with USER24.  Proportionally-spaced versions of the assembly 
  45. fonts are new in version 4.0.      
  46.  
  47. $GF.BAS - The source code for all the QuickBASIC subprogram fonts that use 
  48. the hardwired 8x8 pixel ROM character set that is found in all IBM and clone 
  49. computers, including the required initialization statements. $GFE.BAS - The 
  50. source code for all the QuickBASIC subprogram fonts that use the EGA BIOS 
  51. ROM character set.  An EGA video card and monitor are required.  
  52.  
  53. $GFV.BAS - The source code for all the QuickBASIC subprogram fonts that 
  54. EITHER use the VGA BIOS ROM character set (VGA required), OR the 4k 8x16 
  55. pixel font files.  
  56.  
  57. $PROPOR.BAS - Source code for proportionally-spaced 4k font files.
  58.  
  59. ASMTEST.BAS - Demo of the assembly fonts.
  60.  
  61. GFTEST.BAS - Demo of all the QB fonts with comments and tips on using 
  62. GFONTS.  By browsing the code, you will see the purpose of each statement 
  63. and learn how to make your own fonts.
  64.  
  65. PROPOR.BAS - Demo of the $PROPOR.BAS font files.
  66.  
  67. GFASM.xxx - GFASM contains the call to GFTBL to get the addresses of the EGA 
  68. and VGA ROM character sets as well as the calls to the 26 assembly language 
  69. fonts.  GFASM.ASM is the source code, GFASM.OBJ is the compiled source code, 
  70. GFASM.QLB is the QuickLibrary (for running in the QB environment), and 
  71. GFASM.LIB is the library (for compiling into an EXE program.) The BASIC 7.x 
  72. versions of these files are called GFASM7.xxx.
  73.  
  74. COMPARE.BAS - Kind of like TESTFONT, only better.  Allows you to show two 4k 
  75. fonts side by side so you can choose which you like better.
  76.  
  77. TEXTBOX.BAS - Use assembly language GFONTS in a self-wrapping graphics 
  78. textbox!
  79.  
  80. EGACRSR.BAS - A short program showing how you can produce a blinking cursor 
  81. with the assembly language GFONTS.
  82.  
  83. GLOW.BAS - For VGA card owners only, this program demonstrates fading the 
  84. palette in and out, a nice effect.
  85.  
  86. YNBUTTON.BAS - A demo of a routine you can use or modify to have buttons pop 
  87. up on the screen.  A thousand and one uses.
  88.  
  89. CIRCLE.BAS - A demo just for fun to show the potential of GFONTS. This code 
  90. is shown at the end of GFDEMO.EXE.
  91.  
  92. GFCNVRT.BAS - This program will convert font files created with the public 
  93. domain program, FONTEDIT.COM into BLOADable font table files.  These 4k 
  94. files can then be used with the VGA GFONT calls.  You don't need a VGA to 
  95. use this method as the tables are loaded from disk, not video BIOS.  But the 
  96. VGA GFONT calls are used because they also use an 8x16 matrix.  If you have 
  97. a VGA you can use both the ROM table and file table(s).
  98.  
  99. TESTFILE.BAS - Demonstrates BLOADing 4k font files into BASIC and using the 
  100. font with the regular PRINT statement.  GFONTS is not really used at all.  
  101. You must load QB with the QB.QLB quicklibrary which includes the INTERRUPTX 
  102. routine. 
  103.  
  104. BIGFONT.EXE - Two versions of this program are included, one for EGA owners 
  105. and the other for VGA (they both produce identical font files so if you have 
  106. a VGA you can discard the EGA version.) BIGFONT is a font editor for 16x24 
  107. pixel characters (three times as many pixels as an 8x16 grid.) This new size 
  108. allows detailed type-faces.  Font files (12k) created with BIGFONT are meant 
  109. to be BLOADed into your QB program and then displayed using the assembly 
  110. USER24 call.  BIGFONT font files have proportion al spacing built into them 
  111. and display very fine with USER24p.
  112.  
  113. *.FNT files - There are two kinds of font files with GFONTS (20+ are 
  114. included.)  The first are 4k in size and are meant to be used with the QB 
  115. GFVxxx subroutines and/or the VGAxxx assembly routines.  Each character is 8 
  116. by 16 pixels in size.  The second kind of .FNT file are those 12k in size 
  117. that were created with BIGFONT.EXE.  Each character is 16 by 24 pixels in 
  118. size.  These files are meant to be displayed with the assembly routines 
  119. USER24 and USER24p.
  120.  
  121. FONTEDIT.COM - Michael Mefford's font generating program from PC Magazine 
  122. (see FONTEDIT.DOC for info.)  Provided so users could make their own 4k font 
  123. files.  .COM files created with FONTEDIT must be converted to GFONT font 
  124. files using GFCNVRT.BAS.
  125.  
  126. Also included in the GFONTS package are a 16-PAGE MANUAL and QUICK 
  127. REFERENCE SHEET.
  128.  
  129.                         ------------------------
  130.  
  131. HOW GFONTS WORKS:
  132.  
  133. Every PC has a built-in table of alphanumeric characters in ROM memory.  
  134. This table is located at the beginning of segment &HFFA6.  Each character is 
  135. 8 by 8 pixels in size and is represented by the 8 bits in each of 8 bytes 
  136. (one for each scan line.) If a bit = 0 it is off and if the bit = 1 it is 
  137. turned on. 
  138.  
  139. If you have an EGA or VGA adapter you have additional ROM character sets 
  140. located in the video BIOS.  EGA has an 8x12 pixel character set (actually in 
  141. an 8x14 matrix) and VGA has an 8x14 character set (in an 8x16 matrix.) Thus, 
  142. a VGA has three separate sets; 8x8, 8x14 and 8x16, because VGA also emulates 
  143. an EGA.  Knowing this, it is possible to make up to three versions of each 
  144. font technique.
  145.  
  146. BASIC has a few intrinsic commands for turning pixels on; LINE, PSET, 
  147. CIRCLE, etc...  If a BASIC program can read the data bytes in the ROM 
  148. character table itself, or load such a table from disk, it can reproduce the 
  149. character using BASIC pixel commands instead of the PRINT statement.  An 
  150. ingenious method using the LINE command as a bit-mask for each byte was 
  151. published in PC Magazine.  This was the springboard for GFONTS. 
  152.  
  153. Accessing the ROM BIOS EGA and VGA character sets is not as easy as the 8x8 
  154. set because EGA and VGA video BIOS addresses are not standardized, and may, 
  155. in fact, be copied into RAM for faster execution.  Furthermore, when you 
  156. enter graphics mode, your VGA ROM table is moved again! Since DOS and the 
  157. video BIOS must coexist, the video BIOS pokes some pertinent addresses into 
  158. DOS and someone was thoughtful enough to add a DOS interrupt to query the 
  159. location of the EGA and VGA tables.  This is INT 10 where the A X register = 
  160. 1130h (another method to find the current table is the vector at Interrupt 
  161. 43h.) 
  162.  
  163. What this means to you is that in order to use the ROM EGA and VGA GFONTS 
  164. you must first make a call to DOS, get the EGA/VGA addresses and assign them 
  165. to SHARED variables which the GFONTS routines can then use to display the 
  166. data.  Please note this only has to be done once, at the beginning of each 
  167. program.  You initialize these addresses by CALLing GFTBL (which is in 
  168. GFASM.QLB and .LIB).  Because the VGA table may be moved when you enter 
  169. graphics mode you must have a SCREEN 12 statement just prior to the G FTBL 
  170. call. 
  171.  
  172. QuickBASIC does have a method for accessing DOS interrupt calls.  It is 
  173. located in the QB.LIB and QB.QLB files that come with QuickBASIC, and it is 
  174. called INTERRUPTX.  INTERRUPTX is a nice routine, but it is a little 
  175. overkill for our purposes because it requires the definition of a TYPE array 
  176. for all the registers and flags.  Plus you have to call it twice, once for 
  177. the EGA address and once for the VGA.  Since small (and fast) is beautiful 
  178. in computer programs I have included GFTBL, which takes care of your DOS 
  179. call in about 100 bytes. 
  180.  
  181. The following is the minimum code to set up GFONTS (after loading QB with 
  182. the GFASM quicklibrary): 
  183.  
  184.     DIM SHARED EGAseg%, EGAoffset%, VGAseg%, VGAoffset% 
  185.     SCREEN 9 
  186.     CALL GFTBL (EGAseg%, EGAoffset%, VGAseg%, VGAoffset%) 
  187.  
  188. The DIM SHARED above would be replaced with COMMON SHARED if your 
  189. GFONT routines are located in a separate module (LOADed rather than 
  190. MERGEd.)
  191.  
  192. Now you are ready to call any of the assembly language calls, like 
  193. this...
  194.  
  195.    CALL EGA16x36 ("This is a test", xstart, ystart, xstep, ystep, kolor)
  196.  
  197. It's that easy!
  198.  
  199.                           ----------------------
  200.  
  201. BLOADing a font table:
  202.  
  203. Whether or not you have a VGA, the CALLs to the BASIC "GFVxxx" fonts and the 
  204. assembly "VGAxxx" fonts will work if you have BLOADed a font table file into 
  205. RAM memory and then use its address instead of one you got from the ROM 
  206. BIOS.  With a CGA, HERC or EGA you can consider the VGA calls as *requiring* 
  207. a disk font.  If you have a VGA you can store the ROM BIOS address in backup 
  208. variables and switch back and forth between ROM and your BLOADed font(s).
  209.  
  210. The following is the minimum code you will need to use a BLOADed 4k font 
  211. file with the GFVxxx or VGAxxx GFONTS:
  212.  
  213.     REDIM FontArray(0 TO 2047) AS INTEGER ' create a 4096 byte array and load
  214.     DEF SEG = VARSEG(FontArray(0)) ' load the font file you created.
  215.     BLOAD "filename.fnt", VARPTR(FontArray(0))
  216.     VGAseg = VARSEG(FontArray(0))
  217.     VGAoffset = 0
  218.  
  219. Remember that VGAseg and VGAoffset are SHARED or COMMON variables that the 
  220. BASIC GFONT routines use.  If you have a VGA, you will probably want to save 
  221. the values you got from GFTBL into VGAseg and VGAoffset into backup 
  222. variables (or you can call GFTBL again to use the VGA ROM characters.) 
  223.  
  224. After BLOADing your font file you can then call any of the GFVxxx routines 
  225. like this:
  226.  
  227.     CALL GFVxxx(a$, x, y, xs, ys, clr)
  228.  
  229. Or to call the VGAxxx assembly routines:
  230.  
  231.     CALL VGAxxx(VGAseg, VGAoffset, a$, x, y, xs, ys, clr)
  232.  
  233. See the demo BASIC files, ASMTEST.BAS, COMPARE.BAS, TESTFONT.BAS and GFTEST.BAS for examples of BLOADing font files.
  234.  
  235. BIGFONT.EXE and USER24:
  236.  
  237. Sometimes you just can't get enough information into an 8x16 pixel grid, so 
  238. BIGFONT.EXE and the assembly routines USER24 and USER24p are included with 
  239. GFONTS. With BIGFONT you create a 16x24 pixel character set file, then you 
  240. BLOAD the file into your QB program and CALL USER24 to display them.  USER24 
  241. is part of GFASM.QLB and .LIB.
  242.  
  243. You'll see right away that a 16x24 pixel grid allows creation of custom 
  244. fonts with real character (pun intended).  And because they are written 
  245. directly to video memory with assembly speed they are very fast.  Because of 
  246. this you can make fonts smaller than 16x24 (say a vertical 8x16) and zip 
  247. them on the screen.  GFONTS comes with a set of these 12k font files.  You 
  248. can also wish to design your own sprites or icons for games and special 
  249. effects.  While USER24 will only display single-colored characters, it is 
  250. very fast.
  251.  
  252. BLOADing a BIGFONT 12k font file is the same as a 4k file (except the array 
  253. is bigger.) Please see ASMTEST.BAS for the code and demo of the USER24 call.
  254.  
  255.                              --------------------
  256.  
  257. I have performed a limited amount of speed testing for the various compiled 
  258. options of the GFONTS routines.
  259.  
  260. BASIC GFONTS:
  261.  
  262. GFTEST.BAS (ver 3.0) was compiled without any pauses and timed using three 
  263. compiling options on a 12 mhz 286.
  264.  
  265. COMPILER         LIBRARY   STRING MEM     AVG. TIME (seconds)
  266. ----------------------------------------------------
  267. BC 7.0           GFASM7      Far           19.04
  268. BC 7.0           GFASM       Near          18.83
  269. BC 6.0 (QB 4.1)  GFASM       Near          18.71
  270.  
  271. Results:  Compiling using near strings (GFASM) is slightly faster, due to 
  272. the reduced overhead of the near strings.
  273.  
  274.  
  275. ASSEMBLY GFONTS:
  276.  
  277. The following test shows the result of three EXE files displaying a line of 
  278. each of the thirteen assembly GFONT routines fifteen times (total calls = 
  279. 195) on a 12 mhz 286.
  280.  
  281. COMPILER         LIBRARY   STRING MEM     AVG. TIME (seconds)
  282. ----------------------------------------------------
  283. BC 7.0           GFASM7      Far            2.37
  284. BC 7.0           GFASM       Near           2.57
  285. BC 6.0 (QB 4.1)  GFASM       Near           2.58
  286.  
  287. Results:  Compiling as far strings (GFASM7) is slightly faster, probably due 
  288. to the fact that the assembly variables are placed in the code segment for 
  289. GFASM7 while the variables must be placed in the data (DGROUP) segment in 
  290. the near-string version (GFASM) and segment adresses have to be flip-flopped 
  291. to retain access to DGROUP variables. 
  292.  
  293. CONCLUSIONS:  It's basically six of one and half-dozen of the other. GFONTS 
  294. performs relatively equivalent whether near or far strings and whether BASIC 
  295. 6.0 (= QB 4.x) or BASIC 7.0.  If speed is a concern, stick to the assembly 
  296. fonts as much as possible.
  297.  
  298. P.S.  I have tested GFASM (near strings) and the assembly fonts in Crescent 
  299. Software's PDQ.  They work fine.  The BASIC GFONTS will *NOT* work in PDQ as 
  300. they use BASIC's graphics commands (LINE, CIRCLE, PSET, etc...)
  301.  
  302.                              ---------------------
  303.  
  304. The above text is just a portion of the 16-page manual which comes with 
  305. GFONTS 4.5.  Also included are a complete trouble-shooting guide, 
  306. instructions for creating quicklibraries, full instructions for passing 
  307. parameters (and doing tricks) to GFONT routines, and a separate 
  308. quick-reference guide with complete calling syntax for all routines.
  309.  
  310. GFONTS 4.5 costs $40 (U.S. currency or cheque drawn on U.S. bank only.)  
  311. Credit card orders are NOT acceptable.  Shipping is free to anywhere in the 
  312. world (GFONTS has sold in 15 countries, now.)  
  313.  
  314. Please indicate if you would like GFONTS sent on 5.25 or 3.5 inch diskettes.
  315.  
  316. Thank you for trying GFONTS.
  317.  
  318. Dwain Goforth
  319. 1260 Sunset Ave.
  320. Arcata, CA 95521
  321. (707) 822-1291
  322.  
  323.